home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 255 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.7 KB

  1. From: jbuck@Synopsys.COM (Joe Buck)
  2. Message-ID: <4eucnc$hr9@hermes.synopsys.com>
  3. X-Original-Date: 3 Feb 1996 01:11:08 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 03 Feb 96 06:46:42 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: auto_ptr again
  9. Organization: Synopsys Inc., Mountain View, CA 94043-4033
  10. References: <4ebhn5$lgt@bmtlh10.bnr.ca>
  11. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  12.     iQBFAgUBMRME6+EDnX0m9pzZAQFzBwF9E/a84N4J0RhtBmlcqwr14R3BbejgLSUZ
  13.     F89/OrB+Cn24JPx8B8Fd3WnbENZQ5KOJ
  14.     =zS6o
  15.  
  16. "john (j.d.) hickin" <hickin@bnr.ca> writes:
  17. >And this, the expectation that constructors of the form X(X&) and X(const X&)
  18. >must perform a *copy* operation, is, IMHO, the trouble.
  19.  
  20. No, the notion that these constructors perform copy operations (and only
  21. copy operations) is deeply wired in to the language, in at least three
  22. places: argument passing, return value passing, and optimizing away of
  23. copy constructors all assume these constructors mean "copy".
  24.  
  25. >The original term was reference constructor, a name which, in my opinion,
  26. >carefully stepped around all subtleties of language.
  27.  
  28. I have never seen this term used.  Stroustrup said "copy constructor"
  29. at a very early stage.
  30.  
  31. Anyone who writes a class in which X(X&) or X(const X&) does not have the
  32. semantics of a copy operation is doing something wrong (e.g. auto_ptr in
  33. the draft standard is broken).
  34.  
  35. -- 
  36. -- Joe Buck     <jbuck@synopsys.com>    (not speaking for Synopsys, Inc)
  37.  
  38. Work for something because it is good,
  39. not just because it stands a chance to succeed.       -- Vaclav Havel
  40. ---
  41. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  42.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  43.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  44.